﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Text;

namespace SampleShop
{
    class Product : IProduct
    {
        public long Id { get ; set ; }
        public string Name { get ; set ; }
        /// <summary>
        /// 降价后的价格
        /// </summary>
        public decimal LowerPrice { get; set; }
        private decimal _price;

        public event Action<IProduct> PriceChangeLow;

        
        public decimal Price 
        {
            get { return _price; }
            set
            {
                //当价格下降时就通知客户产品价格下降了
                if (_price > value)
                {
                    LowerPrice = value;
                    PriceChangeLow?.Invoke(this);
                }
                _price = value;
            }
        }
        
    }
}
